package com.threadExample;

import java.util.Date;

/**
 * Created by yijy on 2017/7/19.
 */
public class ThreadTest1 extends Thread{

    private static int k=5;
    @Override
    public void run() {
        for(int i=0;i<10;i++){
            System.out.println(k);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("-------------------");
    }

    public static void main(String[] args) {
//        for(int i=0;i<100;i++){
//            Thread test1 = new ThreadTest1();
//            test1.start();
//        }
////        Thread.sleep(1000);
//        k=100;
//        System.out.println("33333333");
        Date d1 = new Date();
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        Date d2 = new Date();
        if(d1.getTime()-d2.getTime()>0){
            System.out.println(1);
        }else{
            System.out.println(0);
            System.out.println(d1);
            System.out.println(d2);
        }
    }

    public void test(){
    }
}
